<?php
// Browsersprache ermitteln
function lang_getfrombrowser ($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true) {
	// $_SERVER['HTTP_ACCEPT_LANGUAGE'] verwenden, wenn keine Sprachvariable mitgegeben wurde
	if ($lang_variable === null) {
					$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
	}

	// wurde irgendwelche Information mitgeschickt?
	if (empty($lang_variable)) {
					// Nein? => Standardsprache zur�en
					return $default_language;
	}

	// Den Header auftrennen
	$accepted_languages = preg_split('/,\s*/', $lang_variable);

	// Die Standardwerte einstellen
	$current_lang = $default_language;
	$current_q = 0;

	// Nun alle mitgegebenen Sprachen abarbeiten
	foreach ($accepted_languages as $accepted_language) {
		// Alle Infos �iese Sprache rausholen
		$res = preg_match ('/^([a-z]{1,8}(?:-[a-z]{1,8})*)'.
						'(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i', $accepted_language, $matches);

		// war die Syntax g�
		if (!$res) {
			// Nein? Dann ignorieren
			continue;
		}
		
		// Sprachcode holen und dann sofort in die Einzelteile trennen
		$lang_code = explode ('-', $matches[1]);

		// Wurde eine Qualit㲠mitgegeben?
		if (isset($matches[2])) {
			// die Qualit㲠benutzen
			$lang_quality = (float)$matches[2];
		} else {
			// Kompabilit㳳modus: Qualit㲠1 annehmen
			$lang_quality = 1.0;
		}

		// Bis der Sprachcode leer ist...
		while (count ($lang_code)) {
			// mal sehen, ob der Sprachcode angeboten wird
			if (in_array (strtolower (join ('-', $lang_code)), $allowed_languages)) {
				// Qualit㲠anschauen
				if ($lang_quality > $current_q) {
					// diese Sprache verwenden
					$current_lang = strtolower (join ('-', $lang_code));
					$current_q = $lang_quality;
					// Hier die innere while-Schleife verlassen
					break;
				}
			}
			// Wenn wir im strengen Modus sind, die Sprache nicht versuchen zu minimalisieren
			if ($strict_mode) {
				// innere While-Schleife aufbrechen
				break;
			}
			// den rechtesten Teil des Sprachcodes abschneiden
			array_pop ($lang_code);
		}
	}
	
	// die gefundene Sprache zur�en
	return $current_lang;
}

$allowed_langs = array('en', 'de');
$lang = lang_getfrombrowser($allowed_langs, 'en', null, false);

if ( $lang === 'de')
	Header("Location: http://wpbasis.de/readme-de_DE.php");
else
	Header("Location: http://wpbasis.de/readme-en_US.php");
exit();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
	
	<title>Basis Theme f&uuml;r WordPress</title>
	<link rel="shortcut icon" href="http://wpbasis.de/favicon.ico" type="image/x-icon" />
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="content-language" content="de-DE" />
	<script src="http://bueltge.de/mv/?js" type="text/javascript"></script>

	<style type="text/css" media="all">
	/*<![CDATA[*/
		body{background:#fcfcfc;color:#444;font:normal 70%/150% verdana,geneva,sans-serif;margin:0 2em;padding:0;}
		body a{outline:none;}
		body #skipLink{display:block;padding:10px 20px;position:absolute;top:0;left:-999px;}
		body #skipLink:focus{left:0;}
		body blockquote{margin-left:0;border-left:5px solid #f6f6f6;padding-left:0.5em;}
		body code, body pre{font:1em/150% consolas,"courier new", courier, monospace;}
		body pre{margin-top:0};
		body div#wrap{background-color:#fff;border-left:3px solid #f9f9f9;border-right:3px solid #f9f9f9;color:#444;margin:0 auto;padding:1em 2em;width:50em;}
		body div#wrap div#footer{margin:3em auto 1em;text-align:center;}
		body div#wrap div#footer p{background:#ffd;color:#666;display:inline;padding:0.2em 0.5em;}
		body div#wrap div#header{margin:0 auto;text-align:center;}
		body div#wrap div#header p.readme-version{font-size:0.9em;letter-spacing:0.1em;margin:0 0 0.5em;text-transform:uppercase;}
		body h1{font-size:3.2em;}
		body h1 img{margin:0 0 20px;border:none;text-decoration:none;}
		body h1 a{border:none;text-decoration:none;}
		body h1,body h2,body h3{font-family:garamond,georgia,times,serif;font-weight:400;}
		body h2{font-size:2em;margin-top:3em;}
		body h3{font-size:1.6em;margin-top:2em;}
		body ol li ol li,body ol li#features ol li ol li{list-style:decimal;}
		body ol li#functions h3{font-size:1.5em;}
		body ol li#functions ol{list-style:lower-alpha;margin:0 0 0 2em;padding:0;}
		body ol li#lizenz blockquote a{color:#222;text-decoration:none;}
		body ol li#lizenz blockquote strong{font-size:0.9em;font-weight:400;text-transform:uppercase;}
		body ol li,body ol#menu li ol li{list-style:upper-roman;}
		body ol ul li,body ol ol ul li{list-style:square;}
		body ol li pre.shell{margin:-0.5em 2.5em 1em 1em;padding:0.2em 0.5em;background:#eee;}
		body ol#menu li{list-style:none;}
		body ol#menu li ol li ol li,body ol li#functions ol li,body ol li#features ol li{list-style:lower-roman;}
		body #funktionen ol li ul {margin:0 0 10px 0; padding-left:20px;}
		body #funktionen ol li ul li {list-style-type:none;}
		body pre span,body span.bold{font-weight:700;}
		body p span.vcard span.family-name,body p span.vcard span.additional-name{display:none;}
		body p.top{text-align:right;}
		table *{border:none;}
		table tbody th,table tfoot th{background:#ddd;text-align:left;}
		table tbody tr.alt{background:#eee;}
		table tr td,table tr th{padding:0.1em 0.5em;}
	/*]]>*/
	</style>
</head>

<body>
	<div id="wrap">
		<a id="skipLink" accesskey="0" title="Direkt zum Beitrag, Tastaturkuerzel 0" href="#content">&raquo; Direkt zum Beitrag</a>
		<div id="header">
			<h1 id="title">WordPress <em>Basis</em> Theme <small><a title="read the readme in english language" href="index-en_US.html">english</a>/<a href="index-de_DE.html" title="Die readme in deutscher Sprache lesen.">deutsch</a></small></h1>
		</div>
	</div>
		
<?php
 // end index
?>